<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ include file="/WEB-INF/common/taglib.jsp" %>
<%@page import="java.io.PrintWriter,java.io.StringWriter,com.apanal.qlife.common.aop.SysLogAspect"%>

<!doctype html>
<html>
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="renderer" content="webkit">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta content="微社区,Q生活" name="keywords"/>
    <meta content="微社区,Q生活" name="description"/>
    <title>微社区|Q生活</title>
    <link rel="stylesheet" href="${ctx }/static/css/Master.css"/>
</head>

<body class="errorBg">
	<%
        Integer statusCode = (Integer) request.getAttribute("javax.servlet.error.status_code");
        pageContext.setAttribute("statusCode", statusCode);

        String uri = (String) request.getAttribute("javax.servlet.error.request_uri");
        String queryString = request.getQueryString();
        String url = uri + (queryString == null || queryString.length() == 0 ? "" : "?" + queryString);
        pageContext.setAttribute("url", url);

        Throwable ex = (Throwable) request.getAttribute("javax.servlet.error.exception");
        request.setAttribute("ex", ex);
        
        String errorMsg = "";
        if(ex != null){
        	errorMsg = ex.toString();
        }
     	// 日志分组,方便查看多个日志嵌套的情况
     	Long logGroup = (Long) request.getAttribute(SysLogAspect.LOG_GROUP_ID);
     	if (logGroup != null) {
     		errorMsg += " 错误代码：" + logGroup;
		}
        request.setAttribute("errorMsg", errorMsg);

    %>
    
    <div class="errorCon">
        <div class="errorLeft"><a href="javascript:void(0)" onclick="history.back();" title="返回" class="back"></a><a class="backHome" href="${ctx }/welcome" title="返回首页"></a></div>
        <div class="errorRight${statusCode == 444?1:2 }"><img src="${ctx }/static/images/${statusCode }.png" alt="${statusCode }.png"/></div>
    </div>
    
    <%--<div style="display: none;">
    url:${url }<br>
    status:${statusCode }<br>
    exception:${errorMsg }<br>
    <c:if test="${not empty ex}">
	    <%
	        StringWriter stringWriter = new StringWriter();
	        PrintWriter printWriter = new PrintWriter(stringWriter);
	        ex.printStackTrace(printWriter);
	        pageContext.setAttribute("stackTrace", stringWriter.toString());
	    %>
		详细:${stackTrace}
    </c:if>
    </div>--%>
    
</body>
</html>
